package cn.sibu.myroot;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ListView;

public class AdpterEmptyViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_adpter_empty_view);
        ListView listView = (ListView) findViewById(R.id.myList);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.myEmpty);

        /**
         *附加空视图
         * 框架将在ListView的Adapter没有元素时显示此视图
         */
        listView.setEmptyView(linearLayout);

    }
}
